Will someone please post an example of putting a Menu on a Dialog Box? I keep getting exception violations.
llandale - Mon Jan 04 15:47:19 EST 2010 |
|
Re: Menu on Dialog johnzweck - Mon Jan 04 16:59:42 EST 2010
Here is the example out of the reference manual:
#include <utils/icons.inc>
int backColor = colorYellow
int sizes[] = {150, 300}
DB menuDemo = create "Menu Demo"
void doClose(DB x) {
hide x
}
close(menuDemo, false, doClose)
DBE mb = menuBar(menuDemo)
DBE sb = statusBar(menuDemo, "Initial", sizes)
void repaint(DBE c) {
background(c, backColor)
}
DBE canv = canvas(menuDemo, 300, 200, repaint)
string entries[] = {"Size", ">Small", ">Normal", ">Large", "Style", ">Bold", ">Italic"}
char mn[] = {'S', 'm', 'N', 'L', 't', 'B', 'I'}
char hot[] = {ddbNone, ddbNone, ddbNone, ddbNone, ddbNone, ddbNone, ddbNone}
string help[] = {"Set size", "Small fonts", "Normal fonts", "Large fonts", "Set style", "Bold font", "Italic font"}
string inactive[]= {"Never", "Never", "Never", "Never", "Never", "Never", "Never"}
Sensitivity sensitive(int index) {
if (index == 2 || index == 6)
return ddbChecked
return ddbAvailable
}
void cb(int index) {
ack "Menu " helpindex " activated"
}
addMenu(mb, "Format", 'F', entries, mn, hot, help, inactive, sensitive, cb)
show menuDemo
|
|
Re: Menu on Dialog Mathias Mamsch - Mon Jan 04 17:46:18 EST 2010
The bad thing about menu exceptions is, that once you got one, you might get one on future calls to the menu functions too, even if your code is correct this time. Some coding errors seem to mess up the state of the menu real bad, so future calls will fail too. If you get an error with menu calls it is best to restart DOORS or you might end up searching for errors where there are none.
Regards, Mathias
|
|
Re: Menu on Dialog llandale - Tue Jan 05 12:51:47 EST 2010 johnzweck - Mon Jan 04 16:59:42 EST 2010
Here is the example out of the reference manual:
#include <utils/icons.inc>
int backColor = colorYellow
int sizes[] = {150, 300}
DB menuDemo = create "Menu Demo"
void doClose(DB x) {
hide x
}
close(menuDemo, false, doClose)
DBE mb = menuBar(menuDemo)
DBE sb = statusBar(menuDemo, "Initial", sizes)
void repaint(DBE c) {
background(c, backColor)
}
DBE canv = canvas(menuDemo, 300, 200, repaint)
string entries[] = {"Size", ">Small", ">Normal", ">Large", "Style", ">Bold", ">Italic"}
char mn[] = {'S', 'm', 'N', 'L', 't', 'B', 'I'}
char hot[] = {ddbNone, ddbNone, ddbNone, ddbNone, ddbNone, ddbNone, ddbNone}
string help[] = {"Set size", "Small fonts", "Normal fonts", "Large fonts", "Set style", "Bold font", "Italic font"}
string inactive[]= {"Never", "Never", "Never", "Never", "Never", "Never", "Never"}
Sensitivity sensitive(int index) {
if (index == 2 || index == 6)
return ddbChecked
return ddbAvailable
}
void cb(int index) {
ack "Menu " helpindex " activated"
}
addMenu(mb, "Format", 'F', entries, mn, hot, help, inactive, sensitive, cb)
show menuDemo
Thanks, I was trying createMenu and createItem instead of menuBar and addMenu.
|
|